/**
  应用
  说明1.key：唯一值 value：简单数据或复合型数据；
     2.当需要遍历此classMap时，只需要将key值存入一Array数组对此数据进行遍历然后取出对应的Map值。
     var videoMenuMap = new classMap();
     videoMenuMap.put(key, jsonData ); //存入数据
     var jsonDataSyn = videoMenuMap.get(jsonData.isSynthetic ); //取出对应的数据
  */
function classMap() {
    function struct( key, value ) {
        this.key = key;
        this.value = value;
    }

    this.map = new Array();

    this.get = function (key) {
        for (var i = 0 ; i < this.map.length; i++) {
            if ( this.map [i ].key == key ) {
                return this .map [i ].value ;
        }
      }
    }
  
    this.put = function (key, value) {
        for (var i = 0 ; i < this.map.length; i++) {
            if ( this.map [i].key == key ) {
                this.map[i].value = value;
                return;
            }
        }
        this.map[this.map.length] = new struct( key, value );
    }

    this.size = function () {
        return this.map.length ;
    }

    this.init = function(o) {
        for (var i = 0 ; i < o.map.length; i ++) {
            this.setAt(o.map[i].key, o.map[i].value)
        }
    }

    this.remove = function(key) {
        for (var i = 0 ; i < this.map.length; i++) {
            if ( this.map [i].key == key ) {
                 this.map.splice(i, 1);
            }
        }
    }
     
     this.clear = function() {
          this.map.clear();
     }
     
     this.keySet = function() {
            var keyArr = new Array();
            for ( var i = 0; i < this.map.length; i++) {
                keyArr.push( this.map[i].key);
           }
            return keyArr;
     }
}
